package model

import business.Attackable
import business.Blockable
import business.Destroyable
import business.Sufferable
import org.itheima.kotlin.game.core.Painter


class Camp:IView,Blockable,Sufferable,Destroyable {
    override fun isDestroy(): Boolean {
        if(blood<0){
            return true
        }
        return false
    }

    override var blood: Int=5

    override fun notifySuffer(attack: Attackable): Array<IView>? {
        if (attack.owner is Tank){
            return null
        }
        blood-=attack.attackPower
        return arrayOf(Blast(x,y))
    }

    override var x: Int=(Config.col/2)*Config.block
    override var y: Int=(Config.row-1)*Config.block
    override var width: Int=Config.block
    override var height: Int=Config.block

    override fun draw() {
        Painter.drawImage("img/camp.gif",x,y)
    }

}